package org.jeecg.modules.system.mapper;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.system.entity.SysDepartPosition;
import org.jeecg.modules.system.entity.SysPosition;

import java.util.List;

/**
 * @Description: 部门-职位
 * @Author: jeecg-boot
 * @Date:   2019-09-20
 * @Version: V1.0
 */
public interface SysDepartPositionMapper extends BaseMapper<SysDepartPosition> {

    List<SysDepartPosition> findPage(IPage<SysDepartPosition> page,@Param("bean") SysDepartPosition sysDepartPosition);

    List<SysDepartPosition> findPositionListByDepartId(@Param("departId") String departId);


    List<SysDepartPosition> selectPositionList(@Param("departPositionList") List<String> departPositionList);
    @Select("select  position_id from sys_depart_position where depart_id = #{departId} and del_flag ='0'")
    List<String> selectBydepartId(@Param("departId") String departId);

    void addBatch(@Param("sysDepartPosition") SysDepartPosition sysDepartPosition);

    String selectPositionName(@Param("positionIdList") List<String> positionIdList);


    //------------------------------------S端-START--------------------------------------------------
    List<SysDepartPosition> findServerPositionListByDepartId(@Param("tenantId") String tenantId,@Param("departId") String departId);
    @SqlParser(filter = true)
    List<SysPosition> findTenantPositionList(@Param("tenantId") String tenantId);
    @SqlParser(filter = true)
    List<String> getTenantDepartPosition(@Param("tenantId") String tenantId,@Param("departId") String departId);
    @SqlParser(filter = true)
    void saveTenantPositionBatch(@Param("bean") SysDepartPosition sysDepartPosition);
    @SqlParser(filter = true)
    List<SysDepartPosition> findTenantPage(Page<SysDepartPosition> page, @Param("bean") SysDepartPosition sysDepartPosition);
    @SqlParser(filter = true)
    Integer queryExPosition(@Param("positionId") String positionId, @Param("departId") String departId);
    @SqlParser(filter = true)
    boolean updateServerById(@Param("bean") SysDepartPosition sysDepartPosition);

    //------------------------------------S端-END----------------------------------------------------
}
